package com.k2091.washcar.mapper;

import com.k2091.washcar.entity.Cleaner;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.k2091.washcar.entity.Examine;
import com.k2091.washcar.entity.FormInline;
import com.k2091.washcar.entity.Users;
import org.apache.ibatis.annotations.*;

import java.text.Format;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author author
 * @since 2021-06-01
 */
public interface CleanerMapper extends BaseMapper<Cleaner> {
    @Insert("insert into examine values(null,#{id},null,now(),0,#{name},#{phonenum},null,null,#{sex},#{age},#{email})")
    int insert(@Param("name")String name,@Param("id")Long id,@Param("phonenum")String phonenum,@Param("sex")int sex,
               @Param("age")int age,@Param("email")String email);

    @Select("select * from users where name=#{uname} and password=#{upwd}")
    Users selectByNameandPwd(@Param("uname") String uname, @Param("upwd") String upwd);

    //后台管理

    List<Cleaner> selectCleaner(FormInline formInline);

    @Update("update cleaner set status=#{status} where id=#{id}")
    void upCleanerStatus(@Param("id")Long id,@Param("status")int status,@Param("token")String token);

    void deleteCleaner(Long id);

}
